package PyroBots.Vue;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;

import PyroBots.Controlleur.CTerrain;


public class ButtonFlipFlop extends JButton{
	private boolean isPlay = true;

	public ButtonFlipFlop() {
		super();
		this.setIcon(new ImageIcon(getClass().getResource("/img/play.png")));
		this.setEnabled(false);
	}

	public boolean isPlay() {
		return isPlay;
	}

	public void reinit() {
		this.isPlay = true;
		this.setIcon(new ImageIcon(getClass().getResource("/img/play.png")));
	}

	public void change() {
		this.isPlay = !isPlay;
		if (this.isPlay==true)
			this.setIcon(new ImageIcon(getClass().getResource("/img/play.png")));
		else
			this.setIcon(new ImageIcon(getClass().getResource("/img/pause.png")));
	}	
	
	public void notifyCarte(CTerrain c) {
		if (c.isCarteChargee()){
			this.setEnabled(true);
			reinit();
		}
	}
}
